from django.contrib import admin
from .models import *

# Register your models here.


admin.site.register(PredictionRecord)

@admin.register(UserGroup)
class UserGroupAdmin(admin.ModelAdmin):
    list_display = ('id', 'description')
    search_fields = ('description',)

@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'created_at', 'created_by')
    list_filter = ('created_at',)
    search_fields = ('name',)

@admin.register(UserProject)
class UserProjectAdmin(admin.ModelAdmin):
    list_display = ('user', 'project')
    list_filter = ('project',)
    search_fields = ('user__username', 'project__name')

@admin.register(SubProject)
class SubProjectAdmin(admin.ModelAdmin):
    list_display = ('id', 'project', 'progress')
    list_filter = ('project',)
    search_fields = ('content',)

@admin.register(UserSubProject)
class UserSubProjectAdmin(admin.ModelAdmin):
    list_display = ('user', 'subproject')
    list_filter = ('subproject',)
    search_fields = ('user__username',)

@admin.register(ModelInfo)
class ModelInfoAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'created_at', 'project')
    list_filter = ('created_at', 'project')
    search_fields = ('name',)

@admin.register(PredictionResult)
class PredictionResultAdmin(admin.ModelAdmin):
    list_display = ('subproject', 'predicted_effort')
    list_filter = ('subproject__project',)
    search_fields = ('subproject__content',)